<template>
  <el-container>
    <el-header class="header">
      <el-row>
        <el-col class="logo" :span="8" :style="{width:isCollapse?'64px':'240px'}">
          <h2>{{isCollapse?'饿了？':'饿了就上号'}}</h2>
        </el-col>
        <el-col :span="8" class="icon" style="width:0">
          <div
            :class="isCollapse?'el-icon-d-arrow-right':'el-icon-d-arrow-left'"
            @click="isCollapse = !isCollapse"
          ></div>
        </el-col>
        <h1 class="middle">饿了么后台管理界面</h1>
        <el-col :span="8" class="one" style="float:right;">
          <div>
            <el-dropdown class="left">
              <el-button type="primary">
                {{$store.state.admin.adminName}}
                <i class="el-icon-arrow-down el-icon--right"></i>
              </el-button>
              <el-dropdown-menu slot="dropdown">
                <el-button
                  class="btn"
                  type="primary"
                  @click="outAdminInfo"
                >{{$store.state.admin.adminName}}退出登录</el-button>
              </el-dropdown-menu>
            </el-dropdown>
          </div>
        </el-col>
      </el-row>
    </el-header>
    <el-container>
      <el-aside style="width:'230px'">
        <div class="main">
          <el-col :span="3">
            <el-menu default-active="2" class="el-menu-vertical-demo" :router="true">
              <el-submenu index="1">
                <template slot="title">
                  <i class="el-icon-user"></i>
                  <span>管理员设置</span>
                </template>
                <el-menu-item-group>
                  <el-menu-item index="/">管理员登录日志</el-menu-item>
                  <el-menu-item index="/adminList">管理员列表</el-menu-item>
                </el-menu-item-group>
              </el-submenu>
              <el-submenu index="2">
                <template slot="title">
                  <i class="el-icon-office-building"></i>
                  <span>店铺管理</span>
                </template>
                <el-menu-item-group>
                  <el-menu-item index="/shoptypelist">店铺类别列表</el-menu-item>
                  <el-menu-item index="/shoplist">店铺列表</el-menu-item>
                </el-menu-item-group>
              </el-submenu>
              <el-submenu index="3">
                <template slot="title">
                  <i class="el-icon-goblet-full"></i>
                  <span>商品管理</span>
                </template>
                <el-menu-item-group>
                  <el-menu-item index="/goodsTypeList">商品类别列表</el-menu-item>
                  <el-menu-item index="1-3-2">商品列表</el-menu-item>
                </el-menu-item-group>
              </el-submenu>
            </el-menu>
          </el-col>
        </div>
      </el-aside>
      <el-main>
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
import { mapMutations } from "vuex";
export default {
  components: {},
  props: {},
  data() {
    return {
      isCollapse: true,
      time: 10
    };
  },
  watch: {},
  computed: {},
  methods: mapMutations(["outAdminInfo"]),
  created() {},
  mounted() {
    var timer = setInterval(() => {
      this.time--;
      if (this.time == 0) {
        clearInterval(timer);
      }
    }, 1000);
  }
};
</script>
<style lang="less" scoped>
.header {
  width: 100%;
  height: 100px;
  background: skyblue;
  float: left;
  padding: 0;
  text-align: center;
  margin: 0 auto;
  .icon {
    margin-top: 10px;
    margin-left: 50px;
    font-size: 30px;
  }
}
.left {
  margin-left: 500px;
  float: right;
}
.one {
  margin-top: 10px;
}
h2 {
  margin: 0;
  padding: 0;
  margin-top: 10px;
  width: 150px;
}
.middle {
  margin-left: 100px;
  float: left;
  line-height: 10px;
}
.main > div {
  width: 200px;
}
</style>